package com.example.demo041.util;

import org.mybatis.spring.mapper.MapperScannerConfigurer;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class MyBatisConf {
    @Bean
    public MapperScannerConfigurer mapperScannerConfigurer(){
        //定义扫描器实例
        MapperScannerConfigurer mapperScannerConfigurer = new MapperScannerConfigurer();
        //加载SqlSessionfactorybena生产sqlsesionfactory实例
        mapperScannerConfigurer.setSqlSessionFactoryBeanName("sqlSessionFactoryBean");
        //定义扫描的包
        mapperScannerConfigurer.setBasePackage("com.example.demo041.mapper");
        return mapperScannerConfigurer;
    }
}
